<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="commons/header::#head">

</head>
	<script type="text/javascript">
        function changeImg(){
            $('#img').click();
        }
        //限制上传文件的类型和大小
        function validate_img(ele){
            // 返回 KB，保留小数点后两位
            //alert((ele.files[0].size/(1024*1024)).toFixed(2));
            var file = ele.val();
            if(!/.(gif|jpg|jpeg|png|GIF|JPG|bmp)$/.test(file)){

                alert("图片类型必须是.gif,jpeg,jpg,png,bmp中的一种");
                return false;
            }else{
                //alert((ele.files[0].size).toFixed(2));
                //返回Byte(B),保留小数点后两位
                if(((ele[0].files[0].size).toFixed(2))>=(2*1024*1024)){

                    alert("请上传小于2M的图片");
                    return false;
                }else  return true;
            }
            return false;

        }
        function submit(){
            alert("a");
            var articleTitle = $("input[name='articleTitle']").val();
            var context = $("#context").val();
            var cmd = $("input[name='cmd']").val();
            var articleId= $("input[name='articleId']").val();
            alert(cmd);
            if (cmd == "updateArticle") {
                alert(cmd);
                $.post("/article/updateArticle",{'articleTitle':articleTitle,'context':context,'articleId':articleId},function (result) {

                });
            }else{
                location.href="http://localhost:8090/article/addArticle";
            }

        }


            function fileUpload() {
                $.ajax({
                    url: 'http://localhost:8090/file/imgUpLoad',
                    type: 'POST',
                    cache: false,
                    data: formData,
                    processData: false,
                    contentType: false,
                    beforeSend:function(){
                    },
                    success:function(data){
                        alert(data.msg);
                        if(data.code==1){
                            window.location.reload();
                        }
                    },
                    error:function(){
                    }
                });
            }


//			↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑vue↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

		
	</script>
<body>
   <div class="page-container">
   <!--/content-inner-->
<div class="col-md-10" style="padding: 0px">
	   <div class="mother-grid-inner">
	   	<div class="col-md-12 form-group1 "  style="padding: 0px">
			<input type="hidden" name="articleId" th:value="${article.articleId}"/>
             <label for="articleTitle">文章标题</label><input type="text" th:value="${article.articletitle}" name="articleTitle" id="articleTitle" class="form-control"/>
             </div>
             <div class="col-md-12 form-group1 "  style="padding: 0px">
              <label for="control-label">文章正文</label><textarea name="context" th:text="${article.context}" id="context"></textarea>
            </div>
		   <!--<div class="col-md-12 form-group1" style="padding: 0px">-->
			   <!--<div class="main-btn"><a id="changeImg" href="#" onclick="changeImg();">更换图片</a></div>-->
			   <!--<input type="file" id="img" name="img" style="opacity:0"/>-->
		   <!--</div>-->
            <div class="col-md-12 form-group1"  style="padding: 0px">
				<input type="hidden" name="cmd" value="addArticle" th:value="${cmd}"/>
            	<input type="submit" class="btn btn-default" onclick="submit()" value="提交"/>
            </div>
		</div>
</div>
  <!--//content-inner-->
			<!--/sidebar-menu-->
				<!--<div class="sidebar-menu">-->
					<!--<header class="logo1">-->
						<!--<a href="#" class="sidebar-icon"> <span class="fa fa-bars"></span> </a> -->
					<!--</header>-->
						<!--<div style="border-top:1px ridge rgba(255, 255, 255, 0.15)"></div>-->
						<!--<div id="cmsMenu">-->
							<!--<div class="menu">-->
									<!--<ul id="menu">-->
										<!--<li v-for="items in cmsMenuList">-->
											<!--<a href="javascript:void(0);" class="test" v-on:click="test">&lt;!&ndash;<i class="fa fa-tachometer"></i>&ndash;&gt; <span v-text="items.cmname"></span>-->
												<!--<span v-if="items.cmsMenuList != ''" class="fa fa-angle-right" style="float: right"></span>-->
												<!--<div class="clearfix"></div>-->
											<!--</a>-->
											<!--&lt;!&ndash;对顶部导航的操作一级导航不可删除和添加只能微调&ndash;&gt;-->
											<!--<ul id="menu-academico-sub" >-->
												<!--<li id="menu-academico-avaliacoes" v-for="subItems in items.cmsMenuList">-->
													<!--<a href="icons.html" v-text="subItems.cmname"></a></li>-->
										  	<!--</ul>-->
										<!--</li>-->
										<!---->
										<!---->
								  <!--</ul>-->
								<!--</div>-->
						<!--</div>-->
                           <!---->
							  <!--</div>-->
							  <div class="clearfix"></div>		
							</div>
							<script>
							var toggle = true;
										
							$(".sidebar-icon").click(function() {                
							  if (toggle)
							  {
								$(".page-container").addClass("sidebar-collapsed").removeClass("sidebar-collapsed-back");
								$("#menu span").css({"position":"absolute"});
							  }
							  else
							  {
								$(".page-container").removeClass("sidebar-collapsed").addClass("sidebar-collapsed-back");
								setTimeout(function() {
								  $("#menu span").css({"position":"relative"});
								}, 400);
							  }
											
											toggle = !toggle;
										});
							</script>
<!--js -->
<script src="js/jquery.nicescroll.js"></script>
<script src="js/scripts.js"></script>
<!-- Bootstrap Core JavaScript -->
   <script src="js/bootstrap.min.js"></script>
   <!-- /Bootstrap Core JavaScript -->	   
<!-- morris JavaScript -->	
<script src="js/raphael-min.js"></script>
<script src="js/morris.js"></script>
<script>
	$(document).ready(function() {
		//BOX BUTTON SHOW AND CLOSE
	   jQuery('.small-graph-box').hover(function() {
		  jQuery(this).find('.box-button').fadeIn('fast');
	   }, function() {
		  jQuery(this).find('.box-button').fadeOut('fast');
	   });
	   jQuery('.small-graph-box .box-close').click(function() {
		  jQuery(this).closest('.small-graph-box').fadeOut(200);
		  return false;
	   });
	   
	    //CHARTS
	    function gd(year, day, month) {
			return new Date(year, month - 1, day).getTime();
		}
		
		graphArea2 = Morris.Area({
			element: 'hero-area',
			padding: 10,
        behaveLikeLine: true,
        gridEnabled: false,
        gridLineColor: '#dddddd',
        axes: true,
        resize: true,
        smooth:true,
        pointSize: 0,
        lineWidth: 0,
        fillOpacity:0.85,
			data: [
				{period: '2014 Q1', iphone: 2668, ipad: null, itouch: 2649},
				{period: '2014 Q2', iphone: 15780, ipad: 13799, itouch: 12051},
				{period: '2014 Q3', iphone: 12920, ipad: 10975, itouch: 9910},
				{period: '2014 Q4', iphone: 8770, ipad: 6600, itouch: 6695},
				{period: '2015 Q1', iphone: 10820, ipad: 10924, itouch: 12300},
				{period: '2015 Q2', iphone: 9680, ipad: 9010, itouch: 7891},
				{period: '2015 Q3', iphone: 4830, ipad: 3805, itouch: 1598},
				{period: '2015 Q4', iphone: 15083, ipad: 8977, itouch: 5185},
				{period: '2016 Q1', iphone: 10697, ipad: 4470, itouch: 2038},
				{period: '2016 Q2', iphone: 8442, ipad: 5723, itouch: 1801}
			],
			lineColors:['#ff4a43','#a2d200','#22beef'],
			xkey: 'period',
            redraw: true,
            ykeys: ['iphone', 'ipad', 'itouch'],
            labels: ['All Visitors', 'Returning Visitors', 'Unique Visitors'],
			pointSize: 2,
			hideHover: 'auto',
			resize: true
		});
		
	   
	});
	</script>
</body>
</html>